<template>
  <div class="home">
    <banner></banner>
    <IconNav></IconNav>
    <van-divider />
    <NoticeBar></NoticeBar>
    <Ad></Ad>
    <JingPin ref="jp"></JingPin>
    <art ref="art"></art>
    <fan ref="fan"></fan>
    <Recommend ref="recommend" />
    <Tips />
  </div>
</template>

<script>
import Banner from "../components/Banner.vue";
import IconNav from "../components/IconNav.vue";
import NoticeBar from "../components/NoticeBar.vue";
import Ad from "../components/Ad.vue";
import JingPin from "../components/Jing-pin.vue";
import Art from "../components/Art.vue";
import Fan from "../components/Fan.vue";
import Recommend from "../components/Recommend.vue";
import Tips from "../components/Tips.vue";
import {Get} from '../gp.js';

export default {
  name: "Home",
  components: {
    Banner,
    IconNav,
    Tips,
    NoticeBar,
    Ad,
    JingPin,
    Art,
    Fan,
    Recommend,
  },
  data() {
    return {
      arrpro:[]
    };
  },
   mounted(){
    let url='/goods';
    let data={};
    Get(url,data).then((res)=>{
      this.arrpro=res.data.data;//所有商品
      // console.log(this.arrpro);
      let jpData=[this.arrpro[9],this.arrpro[11],this.arrpro[12],this.arrpro[20],this.arrpro[23]];
      let artData=[this.arrpro[3],this.arrpro[13],this.arrpro[27],this.arrpro[28],this.arrpro[33]];
      let fanData=[this.arrpro[34],this.arrpro[35],this.arrpro[36],this.arrpro[37],this.arrpro[38]];
      let recommendData=[this.arrpro[39],this.arrpro[40],this.arrpro[41],this.arrpro[42],this.arrpro[43],this.arrpro[44],this.arrpro[45],this.arrpro[46]];
      this.$refs.jp.update(jpData);
      this.$refs.art.update(artData);
      this.$refs.fan.update(fanData);
      this.$refs.recommend.update(recommendData);     
    });
  },
};
</script>
<style lang="scss" scoped>
.van-divider {
  margin: 0;
}
</style>